package top.ligongzi.hrm.client;

import top.ligongzi.hrm.doc.CourseDoc;
import top.ligongzi.hrm.query.CourseDocQuery;
import top.ligongzi.hrm.util.AjaxResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;
import top.ligongzi.hrm.util.PageList;

@Component
public class CourseDocClientFallbackFactory implements FallbackFactory<CourseDocClient> {
    @Override
    public CourseDocClient create(Throwable throwable) {
        return new CourseDocClient() {
            @Override
            public AjaxResult addOrUpdateCourseDoc(CourseDoc courseDoc) {
                return AjaxResult.me().setSuccess(false).setMessage(throwable.getMessage());
            }

            @Override
            public AjaxResult deleteCourseDoc(Long id) {
                return AjaxResult.me().setSuccess(false).setMessage(throwable.getMessage());
            }

            @Override
            public PageList<CourseDoc> queryPage(CourseDocQuery query) {
                return null;
            }
        };
    }
}
